package com.beidu.lottery.call.constant;

import org.springframework.util.StringUtils;


public enum RedeemCodeTypeEnum {
    /**
     * RedeemCodeType
     * 数据是否生效(0:未生效、1:生效)
     */
    DO_NOT_EFFECTIVE(0,0,"未生效"),
    TAKE_EFFECT(1,1,"未生效"),

    ;

    /**
     * id
     */
    public Integer id;

    /**
     * code
     */
    public Integer code;
    /**
     * msg
     */
    public String msg;

    RedeemCodeTypeEnum(Integer id, Integer code, String msg) {
        this.id = id;
        this.code = code;
        this.msg = msg;
    }

    public static RedeemCodeTypeEnum findByCode(Integer code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (RedeemCodeTypeEnum statusEnum : RedeemCodeTypeEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static RedeemCodeTypeEnum findByMsg(String msg) {
        if (StringUtils.isEmpty(msg)) {
            return null;
        }
        for (RedeemCodeTypeEnum statusEnum : RedeemCodeTypeEnum.values()) {
            if (statusEnum.msg.equals(msg)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static RedeemCodeTypeEnum findById(String id) {
        if (StringUtils.isEmpty(id)) {
            return null;
        }
        for (RedeemCodeTypeEnum statusEnum : RedeemCodeTypeEnum.values()) {
            if (statusEnum.id.equals(id)) {
                return statusEnum;
            }
        }
        return null;
    }

}
